package com.xbongbong.pro.statistic.result.pojo.vo;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.io.Serializable;

/**
 * ehcarts图需要的data数据内容
 * 此种data（内部value是数组）格式对应 折线、面积、柱形图、叠加图、雷达
 * @author zcp
 * @version v1.0
 * @date 2019/2/18 19:31
 * @since v1.0
 */
@Getter
@Setter
@ToString
public class ResultDataChartVO implements Serializable {
    private static final long serialVersionUID = 1024318241676914603L;

    /**
     * 名称
     */
    private String name;
    /**
     * 值:["40","60","50","40","40","60","50","40","40","60","50","40"]
     */
    private JSONArray value;
    /**
     * 单位
     */
    private String unit;
    /**
     * 分别采用两个不同单位的y轴，默认为yAxisIndex: 0，当为1时，代表另外一个y坐标轴
     */
    private Integer yAxisIndex;
    /**
     * 是否隐藏，默认0不隐藏  1隐藏，0不隐藏
     * 如合同金额分析，环比增长和同比增长默认是灰掉的
     */
    private Integer hide;
    /**
     * 报表类型，用枚举维护@see ChartTypeEnum
     * 如果该值为空则默认用图表本身的chartType，如果不为空，则用该值渲染图类型。比如合同金额分析，图本身是柱形图，但是环比同比是折线
     */
    private Integer chartType;
    /**
     * 左侧标题
     */
    private  String yAxisName;

    /**
     * 用于柱形图和折线图的预警回显
     */
    private JSONArray warningValues;

    /**
     *  数据格式，千分号，百分比，精度
     */
    private JSONObject dataForm;

    private Long formId;

    private String attr;

    private String originAttr;

    /**
     * 散点图使用 - 气泡大小
     */
    private JSONArray scatterSizeList;

    /**
     * 前端经销商管理柱状图需要特殊处理展示，需要此标志
     */
    private Integer distributorMark;

    /**
     * 散点图使用，值的字段名称，如果设置了系列则name字段为系列的字段名称，该字段需要跟name字段进行区分。
     */
    private String valueName;

    public ResultDataChartVO() {
        this.yAxisIndex = 0;
        this.hide = 0;
    }

    public ResultDataChartVO(String name, String unit, JSONArray value) {
        this.name = name;
        this.value = value;
        this.unit = unit;
        this.yAxisIndex = 0;
        this.hide = 0;
    }
    
    public ResultDataChartVO(String name, String unit, JSONArray value, JSONObject dataForm) {
        this.name = name;
        this.value = value;
        this.unit = unit;
        this.dataForm = dataForm;
        this.yAxisIndex = 0;
        this.hide = 0;
    }

    public ResultDataChartVO(String name, JSONArray value, String unit, Integer yAxisIndex, Integer hide, Integer chartType) {
        this.name = name;
        this.value = value;
        this.unit = unit;
        this.yAxisIndex = yAxisIndex;
        this.hide = hide;
        this.chartType = chartType;
    }

    public ResultDataChartVO(String name, JSONArray value, String unit, Integer yAxisIndex, Integer hide, Integer chartType, JSONObject dataForm) {
        this.name = name;
        this.value = value;
        this.unit = unit;
        this.yAxisIndex = yAxisIndex;
        this.hide = hide;
        this.chartType = chartType;
        this.dataForm = dataForm;
    }
}
